<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "tb_unit".
 *
 * @property int $id
 * @property string $name 计量单位
 * @property int $status 状态
 * @property int $unitTypeId
 * @property int $default
 * @property int $rate
 * @property string $guid
 * @property int $isDelete
 */
class Unit extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'tb_unit';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['name'],'required'],
            [['name'], 'unique','message' =>'单位名称不能重复'],
            [['status', 'unitTypeId', 'default', 'rate', 'isDelete'], 'integer'],
            [['name', 'guid'], 'string', 'max' => 50],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => '单位名称',
            'status' => '状态',
            'unitTypeId' => 'Unit Type ID',
            'default' => 'Default',
            'rate' => 'Rate',
            'guid' => 'Guid',
            'isDelete' => 'Is Delete',
        ];
    }
}
